retire is_fatal for better static analysis (#797)
authortsteven4 <13596209+tsteven4@users.noreply.github.com>
Thu, 16 Dec 2021 22:00:12 +0000 (15:00 -0700)
committerGitHub <noreply@github.com>
Thu, 16 Dec 2021 22:00:12 +0000 (15:00 -0700)
* join is_fatal lines in prep for transformation.

1,$g/is_fatal.*[^;]$/j

* replace is_fatal with if() fatal().

this allows better static analysis.

sed -i '1,$s/^\( *\)is_fatal *( *\(.*\), *MYNAME\([^;]*\);$/\1if (\2) {\n\1  fatal(MYNAME\3;\n\1}/' $file
sed -i '1,$s/^\( *\)is_fatal *( *\(.*\), *"\([^;]*\);$/\1if (\2) {\n\1  fatal("\3;\n\1}/' $file

* manual delete extra parenthesis.

18 files changed:
defs.h
exif.cc
f90g_track.cc
garmin_fit.cc
garmin_gpi.cc
garmin_txt.cc
gbfile.cc
gdb.cc
globalsat_sport.cc
magproto.cc
mapbar_track.cc
mmo.cc
raymarine.cc
subrip.cc
unicsv.cc
util.cc
vecs.cc
xcsv.cc

diff --git a/defs.h b/defs.h
index b57b1ed958ad63fe6e6c60e07c4827db11a536be..05bfa2305949a3cb31af846d8300c91525b37225 100644 (file)
--- a/defs.h
+++ b/defs.h
@@ -1058,7 +1058,6 @@ extern const QVector<style_vecs_t> style_list;
 
 [[noreturn]] void fatal(QDebug& msginstance);
 [[noreturn]] void fatal(const char*, ...) PRINTFLIKE(1, 2);
-void is_fatal(int condition, const char*, ...) PRINTFLIKE(2, 3);
 void warning(const char*, ...) PRINTFLIKE(1, 2);
 
 void printposn(double c, int is_lat);
diff --git a/exif.cc b/exif.cc
index a2e217efb0b5e4b6709a0088fe8acbd51579e870..612b0672416ff48e80c257686c64526c9fcbcec1 100644 (file)
--- a/exif.cc
+++ b/exif.cc
@@ -684,8 +684,12 @@ exif_examine_app(ExifApp* app)
 
   gbfrewind(ftmp);
   uint32_t ident = gbfgetuint32(ftmp);
-  is_fatal(ident != 0x66697845, MYNAME ": Invalid EXIF header magic.");
-  is_fatal(gbfgetint16(ftmp) != 0, MYNAME ": Error in EXIF header.");
+  if (ident != 0x66697845) {
+    fatal(MYNAME ": Invalid EXIF header magic.");
+  }
+  if (gbfgetint16(ftmp) != 0) {
+    fatal(MYNAME ": Error in EXIF header.");
+  }
   uint16_t endianness = gbfgetint16(ftmp);
 
   if (global_opts.debug_level >= 3) {
@@ -1488,10 +1492,15 @@ static void
 exif_read()
 {
   uint16_t soi = gbfgetuint16(fin_);
-  is_fatal(soi != 0xFFD8, MYNAME ": Unknown image file.");  /* only jpeg for now */
+  /* only jpeg for now */
+  if (soi != 0xFFD8) {
+    fatal(MYNAME ": Unknown image file.");
+  }
 
   exif_app_ = exif_load_apps();
-  is_fatal(exif_app_ == nullptr, MYNAME ": No EXIF header in source file \"%s\".", fin_->name);
+  if (exif_app_ == nullptr) {
+    fatal(MYNAME ": No EXIF header in source file \"%s\".", fin_->name);
+  }
 
   exif_examine_app(exif_app_);
   Waypoint* wpt = exif_waypt_from_exif_app(exif_app_);
@@ -1509,12 +1518,18 @@ exif_wr_init(const QString& fname)
   exif_apps = new QList<ExifApp*>;
 
   fin_ = gbfopen_be(fname, "rb", MYNAME);
-  is_fatal(fin_->is_pipe, MYNAME ": Sorry, this format cannot be used with pipes!");
+  if (fin_->is_pipe) {
+    fatal(MYNAME ": Sorry, this format cannot be used with pipes!");
+  }
 
   uint16_t soi = gbfgetuint16(fin_);
-  is_fatal(soi != 0xFFD8, MYNAME ": Unknown image file.");
+  if (soi != 0xFFD8) {
+    fatal(MYNAME ": Unknown image file.");
+  }
   exif_app_ = exif_load_apps();
-  is_fatal(exif_app_ == nullptr, MYNAME ": No EXIF header found in source file \"%s\".", fin_->name);
+  if (exif_app_ == nullptr) {
+    fatal(MYNAME ": No EXIF header found in source file \"%s\".", fin_->name);
+  }
   exif_examine_app(exif_app_);
   gbfclose(fin_);
 
index 77e50a5e7351c87aec49e80e7e272c9e414d4d7f..f9eee80e6dc262f6bf6200275a9564043ef5ac4f 100644 (file)
@@ -90,7 +90,9 @@ f90g_track_read()
   char northSouth, eastWest, velocityMark, ttRec[TTRECORDSIZE], tempBuf[20];
   int year, mon, mday, hour, min, sec, latitudeDeg, latitudeMin, longitudeDeg, longitudeMin, velocity;
 
-  is_fatal((track == nullptr), MYNAME "Track setup error");
+  if (track == nullptr) {
+    fatal(MYNAME "Track setup error");
+  }
   for (;;) {
     if ((gbfread((void*)ttRec, 1, 2, fin) != 2)
         || (memcmp(ttRec,"TT",2))) {
index c753075305deacce8761ea791571b1e5342300e5..7347b2119a95c78d3d026fb65cabffbd3d1e29e9 100644 (file)
@@ -107,8 +107,9 @@ GarminFitFormat::fit_parse_header()
   // data length
   fit_data.len = gbfgetuint32(fin);
   // File signature
-  is_fatal(gbfread(sig, 4, 1, fin) != 1,
-           MYNAME ": Unexpected end of file\n");
+  if (gbfread(sig, 4, 1, fin) != 1) {
+    fatal(MYNAME ": Unexpected end of file\n");
+  }
   if (sig[0] != '.' || sig[1] != 'F' || sig[2] != 'I' || sig[3] != 'T') {
     fatal(MYNAME ": .FIT signature missing\n");
   }
index fc9d21262bf1fc53b4581d2f6c556a68c94dea85..868f4a5e384b6c9ace50c1ea189c2da077bf1eee 100644 (file)
@@ -297,14 +297,16 @@ gpi_read_string(const char* field)
     char first = gbfgetc(fin);
     if (first == 0) {
 
-      is_fatal((gbfgetc(fin) != 0),
-               MYNAME ": Error reading field '%s'!", field);
+      if (gbfgetc(fin) != 0) {
+        fatal(MYNAME ": Error reading field '%s'!", field);
+      }
 
       lc_string res1 = gpi_read_lc_string();
       if ((res1.strlen + 4) < l0) { // dual language?
         lc_string res2 = gpi_read_lc_string();
-        is_fatal((res1.strlen + 4 + res2.strlen + 4 != l0),
-                 MYNAME ": Error out of sync (wrong size %d/%d/%d) on field '%s'!", l0, res1.strlen, res2.strlen, field);
+        if (res1.strlen + 4 + res2.strlen + 4 != l0) {
+          fatal(MYNAME ": Error out of sync (wrong size %d/%d/%d) on field '%s'!", l0, res1.strlen, res2.strlen, field);
+        }
         if (opt_lang && (opt_lang  == res1.lc)) {
           string = res1.str;
         } else if (opt_lang && (opt_lang == res2.lc)) {
@@ -313,8 +315,9 @@ gpi_read_string(const char* field)
           fatal(MYNAME ": Must select language code, %s and %s found.\n", res1.lc.constData(), res2.lc.constData());
         }
       } else { // normal case, single language
-        is_fatal((res1.strlen + 4 != l0),
-                 MYNAME ": Error out of sync (wrong size %d/%d) on field '%s'!", l0, res1.strlen, field);
+        if (res1.strlen + 4 != l0) {
+          fatal(MYNAME ": Error out of sync (wrong size %d/%d) on field '%s'!", l0, res1.strlen, field);
+        }
         string = res1.str;
       }
     } else {
@@ -1269,7 +1272,9 @@ load_bitmap_from_file(const char* fname, unsigned char** data, int* data_sz)
   unsigned char* ptr;
 
   gbfile* f = gbfopen_le(fname, "rb", MYNAME);
-  is_fatal(gbfgetint16(f) != 0x4d42, MYNAME ": No BMP image.");
+  if (gbfgetint16(f) != 0x4d42) {
+    fatal(MYNAME ": No BMP image.");
+  }
 
   /* read a standard bmp file header */
   src_h.size = gbfgetint32(f);
index d6a71236a140b8e8f9d465aee1ed63398d7c1bb4..38a4e72f6e378091b3ea647929ad53804cbb012e 100644 (file)
@@ -760,7 +760,9 @@ garmin_txt_wr_init(const QString& fname)
   init_date_and_time_format();
   if (opt_precision) {
     precision = atoi(opt_precision);
-    is_fatal(precision < 0, MYNAME ": Invalid precision (%s)!", opt_precision);
+    if (precision < 0) {
+      fatal(MYNAME ": Invalid precision (%s)!", opt_precision);
+    }
   }
 
   datum_str = get_option_val(opt_datum, nullptr);
@@ -900,7 +902,9 @@ parse_date_and_time(const QString& str, time_t* value)
   char* cerr = strptime(cin, date_time_format, &tm);
   if (cerr == nullptr) {
     cerr = strptime(cin, "%m/%d/%Y %I:%M:%S %p", &tm);
-    is_fatal(cerr == nullptr, MYNAME ": Invalid date or/and time \"%s\" at line %d!", qPrintable(tstr), current_line);
+    if (cerr == nullptr) {
+      fatal(MYNAME ": Invalid date or/and time \"%s\" at line %d!", qPrintable(tstr), current_line);
+    }
   }
 
 //     printf(MYNAME "_parse_date_and_time: %02d.%02d.%04d, %02d:%02d:%02d\n",
@@ -996,7 +1000,9 @@ parse_display(const QString& str, int* val)
 static void
 bind_fields(const header_type ht)
 {
-  is_fatal((grid_index < 0) || (datum_index < 0), MYNAME ": Incomplete or invalid file header!");
+  if ((grid_index < 0) || (datum_index < 0)) {
+    fatal(MYNAME ": Incomplete or invalid file header!");
+  }
 
   if (header_ct[unknown_header] <= 0) {
     return;
@@ -1237,9 +1243,13 @@ parse_route_waypoint(const QStringList& lineparts)
     int field_no = header_fields[rtept_header][column];
     switch (field_no) {
     case 1:
-      is_fatal((str.isEmpty()), MYNAME ": Route waypoint without name at line %d!\n", current_line);
+      if (str.isEmpty()) {
+        fatal(MYNAME ": Route waypoint without name at line %d!\n", current_line);
+      }
       wpt = find_waypt_by_name(str);
-      is_fatal((wpt == nullptr), MYNAME ": Route waypoint \"%s\" not in waypoint list (line %d)!\n", qPrintable(str), current_line);
+      if (wpt == nullptr) {
+        fatal(MYNAME ": Route waypoint \"%s\" not in waypoint list (line %d)!\n", qPrintable(str), current_line);
+      }
       wpt = new Waypoint(*wpt);
       break;
     }
index b9f8c906c0cb22a02d3d6179b5207fbd6a44e25c..a2c86b28c7e81f807bd2bcb368d2634944ceaa3c 100644 (file)
--- a/gbfile.cc
+++ b/gbfile.cc
@@ -218,7 +218,9 @@ gzapi_eof(gbfile* self)
       /* we are at the end of the file */
       if (global_opts.debug_level > 0) {
         /* now gzeof() should return 1 */
-        is_fatal(!gzeof(self->handle.gz), "zlib gzeof error!\n");
+        if (!gzeof(self->handle.gz)) {
+          fatal("zlib gzeof error!\n");
+        }
       }
       res = 1;
     }
@@ -917,8 +919,9 @@ gbfgetint32(gbfile* file)
 {
   char buf[4];
 
-  is_fatal((gbfread(&buf, 1, sizeof(buf), file) != sizeof(buf)),
-           "%s: Unexpected end of file (%s)!\n", file->module, file->name);
+  if (gbfread(&buf, 1, sizeof(buf), file) != sizeof(buf)) {
+    fatal("%s: Unexpected end of file (%s)!\n", file->module, file->name);
+  }
 
   if (file->big_endian) {
     return be_read32(buf);
@@ -936,8 +939,9 @@ gbfgetint16(gbfile* file)
 {
   char buf[2];
 
-  is_fatal((gbfread(&buf, 1, sizeof(buf), file) != sizeof(buf)),
-           "%s: Unexpected end of file (%s)!\n", file->module, file->name);
+  if (gbfread(&buf, 1, sizeof(buf), file) != sizeof(buf)) {
+    fatal("%s: Unexpected end of file (%s)!\n", file->module, file->name);
+  }
 
   if (file->big_endian) {
     return be_read16(buf);
@@ -955,8 +959,9 @@ gbfgetdbl(gbfile* file)
 {
   char buf[8];
 
-  is_fatal((gbfread(&buf, 1, sizeof(buf), file) != sizeof(buf)),
-           "%s: Unexpected end of file (%s)!\n", file->module, file->name);
+  if (gbfread(&buf, 1, sizeof(buf), file) != sizeof(buf)) {
+    fatal("%s: Unexpected end of file (%s)!\n", file->module, file->name);
+  }
 
   return endian_read_double(buf, ! file->big_endian);
 }
@@ -970,8 +975,9 @@ gbfgetflt(gbfile* file)
 {
   char buf[4];
 
-  is_fatal((gbfread(&buf, 1, sizeof(buf), file) != sizeof(buf)),
-           "%s: Unexpected end of file (%s)!\n", file->module, file->name);
+  if (gbfread(&buf, 1, sizeof(buf), file) != sizeof(buf)) {
+    fatal("%s: Unexpected end of file (%s)!\n", file->module, file->name);
+  }
 
   return endian_read_float(buf, ! file->big_endian);
 }
@@ -1046,8 +1052,9 @@ gbfgetpstr(gbfile* file)
   }
   QByteArray ba;
   ba.resize(len);
-  is_fatal((gbfread(ba.data(), 1, len, file) != (gbsize_t) len),
-           "%s: Unexpected end of file (%s)!\n", file->module, file->name);
+  if (gbfread(ba.data(), 1, len, file) != (gbsize_t) len) {
+    fatal("%s: Unexpected end of file (%s)!\n", file->module, file->name);
+  }
 
   return QString(ba);
 }
diff --git a/gdb.cc b/gdb.cc
index 60750580244a78b4ca4c2bb65022bba254942d69..1c801d3bb1399ccbbaef31059f5e122f5cf8d627 100644 (file)
--- a/gdb.cc
+++ b/gdb.cc
@@ -419,24 +419,30 @@ read_file_header()
        The following message "local buffer overflow detected..." could be
        misinterpreted.
   */
-  is_fatal(strcmp(buf, "MsRcf") != 0, MYNAME ": Invalid file \"%s\"!", fin->name);
+  if (strcmp(buf, "MsRcf") != 0) {
+    fatal(MYNAME ": Invalid file \"%s\"!", fin->name);
+  }
 
   int reclen = FREAD_i32;
   Q_UNUSED(reclen);
   QByteArray drec = FREAD_STR();
-  is_fatal(drec.at(0) != 'D', MYNAME ": Invalid file \"%s\"!", fin->name);
+  if (drec.at(0) != 'D') {
+    fatal(MYNAME ": Invalid file \"%s\"!", fin->name);
+  }
 
   gdb_ver = drec.at(1) - 'k' + 1;
-  is_fatal((gdb_ver < GDB_VER_MIN) || (gdb_ver > GDB_VER_MAX),
-           MYNAME ": Unknown or/and unsupported GDB version (%d.0)!", gdb_ver);
+  if ((gdb_ver < GDB_VER_MIN) || (gdb_ver > GDB_VER_MAX)) {
+    fatal(MYNAME ": Unknown or/and unsupported GDB version (%d.0)!", gdb_ver);
+  }
 
   if (global_opts.verbose_status > 0) {
     printf(MYNAME ": Reading Garmin GPS Database version %d.0\n", gdb_ver);
   }
 
   reclen = FREAD_i32;
-  is_fatal((reclen + 1 > int(sizeof(buf))),
-           MYNAME ": Invalid record length\n");
+  if (reclen + 1 > int(sizeof(buf))) {
+    fatal(MYNAME ": Invalid record length\n");
+  }
   (void) FREAD(buf, reclen + 1);
   if (global_opts.verbose_status > 0) {
     const char* name = buf+2;
@@ -449,7 +455,9 @@ read_file_header()
   }
 
   QByteArray applicationField = FREAD_STR();
-  is_fatal(!((applicationField == "MapSource") || (applicationField == "BaseCamp")), MYNAME ": Not a recognized signature in header");
+  if (!((applicationField == "MapSource") || (applicationField == "BaseCamp"))) {
+    fatal(MYNAME ": Not a recognized signature in header");
+  }
 }
 
 /*-----------------------------------------------------------------------------*/
@@ -1084,7 +1092,9 @@ read_data()
     }
 
     int delta = len - gbftell(ftmp);
-    is_fatal(delta > 1000000, "Internal consistency error.  Delta too big");
+    if (delta > 1000000) {
+      fatal("Internal consistency error.  Delta too big");
+    }
 
     // Avoid finite loop on bogus beta files from '06.
     // THe 100000 is totally pulled from my hat.
@@ -1745,8 +1755,9 @@ gdb_wr_init(const QString& fname)
   gdb_ver = (gdb_opt_ver && *gdb_opt_ver) ? atoi(gdb_opt_ver) : 0;
 
   if (gdb_category) {
-    is_fatal((gdb_category < 1) || (gdb_category > 16),
-             MYNAME ": cat must be between 1 and 16!");
+    if ((gdb_category < 1) || (gdb_category > 16)) {
+      fatal(MYNAME ": cat must be between 1 and 16!");
+    }
     gdb_category = 1 << (gdb_category - 1);
   }
 
index f1a90318f603987f59945657949c28e95c92cae1..a5b7f9e73606de149368029fc01997b0b442927a 100644 (file)
@@ -121,7 +121,9 @@ GlobalsatSportFormat::recv_byte()
     result=serial_recv_byte();
   } else {
     result = gbfgetc(in_file);
-    is_fatal((result < 0), MYNAME ": read error");
+    if (result < 0) {
+      fatal(MYNAME ": read error");
+    }
   }
   // Check if byte should be dumped also into a file
   if (dumpfile) {
@@ -280,7 +282,9 @@ GlobalsatSportFormat::rd_init(const QString& fname)
   } else {
     // read from dump-file instead of serial
     in_file = gbfopen(fname, "rb", MYNAME);
-    is_fatal(!in_file, "Could not open dumpfile for input: %s", qPrintable(fname));
+    if (!in_file) {
+      fatal("Could not open dumpfile for input: %s", qPrintable(fname));
+    }
 
   }
   if (opt_timezone) {
index ca9fb5adb51b9364b046d18d86bd9fadb280b9fd..920d8be78b5647b63008d045a22a7ec4ff16f0e0 100644 (file)
@@ -1049,10 +1049,14 @@ mag_rteparse(char* rtemsg)
   QString rte_name;
   if (explorist) {
     char* ca = rtemsg + n;
-    is_fatal(*ca++ != ',', MYNAME ": Incorrectly formatted route line '%s'", rtemsg);
+    if (*ca++ != ',') {
+      fatal(MYNAME ": Incorrectly formatted route line '%s'", rtemsg);
+    }
 
     char* ce = strchr(ca, ',');
-    is_fatal(ce == nullptr, MYNAME ": Incorrectly formatted route line '%s'", rtemsg);
+    if (ce == nullptr) {
+      fatal(MYNAME ": Incorrectly formatted route line '%s'", rtemsg);
+    }
 
     if (ca == ce) {
       rte_name = "Route";
index be272179ce09462810f6d411f9272836416cbb78..002c8867c328633c40924621eb5f71eeaa073511 100644 (file)
@@ -116,9 +116,13 @@ mapbar_track_read()
   int end_flag = gbfgetint32(fin);
   while (!end_flag) {
     int length = gbfgetint32(fin);
-    is_fatal((length < 1) || (length > 1600), MYNAME ": get bad buffer length");
+    if ((length < 1) || (length > 1600)) {
+      fatal(MYNAME ": get bad buffer length");
+    }
 
-    is_fatal((length % 8 != 0), MYNAME ": bad buffer size");
+    if (length % 8 != 0) {
+      fatal(MYNAME ": bad buffer size");
+    }
     gbfseek(fin, 16, SEEK_CUR);
 
     const int amount = length/8;
diff --git a/mmo.cc b/mmo.cc
index ddf41b046752dab10550cfcb3062369ac1f9d345..d58810a005aa1a76ad1f2c6ef960a60feeda818f 100644 (file)
--- a/mmo.cc
+++ b/mmo.cc
@@ -826,7 +826,9 @@ mmo_read_object()
     objid = mmo_object_id++;
 
     uint16_t version = gbfgetuint16(fin);
-    is_fatal(version != mmo_version, MYNAME ": Invalid version identifier!\n");
+    if (version != mmo_version) {
+      fatal(MYNAME ": Invalid version identifier!\n");
+    }
 
     int len = gbfgetint16(fin);
 
index aaa1988dd424d10dfbf1853841fc5c548989a22b..d992734236f515342612319de2003ccc9888131b 100644 (file)
@@ -415,8 +415,9 @@ write_route_wpt_cb(const Waypoint* wpt)
 static void
 enum_route_hdr_cb(const route_head* rte)
 {
-  is_fatal(rte->rte_waypt_ct() > 50,
-           MYNAME ": Routes with more than 50 points are not supported by Raymarine!");
+  if (rte->rte_waypt_ct() > 50) {
+    fatal(MYNAME ": Routes with more than 50 points are not supported by Raymarine!");
+  }
 }
 
 static short_handle
index 3ced5b26dc16c130583fd524116a88f34ee6b482..6bcb1c7d010d62e55e55dbbf069015f75b681040 100644 (file)
--- a/subrip.cc
+++ b/subrip.cc
@@ -84,7 +84,9 @@ SubripFormat::subrip_prevwp_pr(const Waypoint* waypointp)
     switch (*c) {
     case '%':
       fmt = *++c;
-      is_fatal(fmt == '\0', "No character after %% in subrip format");
+      if (fmt == '\0') {
+        fatal("No character after %% in subrip format");
+      }
 
       switch (fmt) {
       case 's':
@@ -136,7 +138,9 @@ SubripFormat::subrip_prevwp_pr(const Waypoint* waypointp)
 
     case '\\':
       fmt = *++c;
-      is_fatal(fmt == '\0', "No character after \\ in subrip format");
+      if (fmt == '\0') {
+        fatal("No character after \\ in subrip format");
+      }
       switch (fmt) {
       case 'n':
         gbfprintf(fout, "\n");
index 3faca3f499a18f13a3414b5fcb211b9bb13205b2..96f5a1f7a129ba717acf7d8e3d2f2bd0bc3f1b99 100644 (file)
--- a/unicsv.cc
+++ b/unicsv.cc
@@ -300,7 +300,9 @@ UnicsvFormat::unicsv_parse_time(const char* str, int* usec, time_t* date)
     }
   }
   int ct = sscanf(str, "%d%1[.://]%d%1[.://]%d%lf", &hour, sep, &min, sep, &sec, &us);
-  is_fatal(ct < 5, MYNAME ": Could not parse time string (%s).\n", str);
+  if (ct < 5) {
+    fatal(MYNAME ": Could not parse time string (%s).\n", str);
+  }
   if (ct == 6) {
     *usec = lround((us * 1000000));
     if (*usec > 999999) {
diff --git a/util.cc b/util.cc
index fb9921a96b86b9f04d2a2bc7f4206fd9d76b2819..0bae87a0e7fb6ced65b636350aa748bebe165739 100644 (file)
--- a/util.cc
+++ b/util.cc
@@ -533,23 +533,6 @@ printposn(const double c, int is_lat)
   printf("%f%c ", fabs(c), d);
 }
 
-void
-is_fatal(const int condition, const char* fmt, ...)
-{
-  va_list args;
-  char buff[128];
-
-  if (condition == 0) {
-    return;
-  }
-
-  va_start(args, fmt);
-  vsnprintf(buff, sizeof(buff), fmt, args);
-  va_end(args);
-
-  fatal("%s\n", buff);
-}
-
 /*
  * Read 4 bytes in big-endian.   Return as "int" in native endianness.
  */
@@ -1136,7 +1119,9 @@ convert_human_date_format(const char* human_datef)
       okay = 0;
     }
 
-    is_fatal(okay == 0, "Invalid character \"%c\" in date format!", *cin);
+    if (okay == 0) {
+      fatal("Invalid character \"%c\" in date format!", *cin);
+    }
   }
   return result;
 }
@@ -1226,7 +1211,9 @@ convert_human_time_format(const char* human_timef)
       okay = 0;
     }
 
-    is_fatal(okay == 0, "Invalid character \"%c\" in time format!", *cin);
+    if (okay == 0) {
+      fatal("Invalid character \"%c\" in time format!", *cin);
+    }
   }
   return result;
 }
diff --git a/vecs.cc b/vecs.cc
index b050ef03f417ffb44be1aefc8b8907b10d64085b..4c5b1485cfdbdc17b80920242464c91d315f6b16 100644 (file)
--- a/vecs.cc
+++ b/vecs.cc
@@ -133,8 +133,9 @@ void Vecs::assign_option(const QString& module, arglist_t* arg, const char* val)
       c = "0";
     } else {
       int test;
-      is_fatal(1 != sscanf(c, "%d", &test),
-               "%s: Invalid parameter value %s for option %s", qPrintable(module), val, arg->argstring);
+      if (1 != sscanf(c, "%d", &test)) {
+        fatal("%s: Invalid parameter value %s for option %s", qPrintable(module), val, arg->argstring);
+      }
     }
     break;
   case ARGTYPE_FLOAT:
@@ -142,8 +143,9 @@ void Vecs::assign_option(const QString& module, arglist_t* arg, const char* val)
       c = "0";
     } else {
       double test;
-      is_fatal(1 != sscanf(c, "%lf", &test),
-               "%s: Invalid parameter value %s for option %s", qPrintable(module), val, arg->argstring);
+      if (1 != sscanf(c, "%lf", &test)) {
+        fatal("%s: Invalid parameter value %s for option %s", qPrintable(module), val, arg->argstring);
+      }
     }
     break;
   case ARGTYPE_BOOL:
diff --git a/xcsv.cc b/xcsv.cc
index 20e3ad66536e992b2aeead75151aadc88bc0a3c0..c488de406e85a0d118f47abd9135a66fbc9db2ed 100644 (file)
--- a/xcsv.cc
+++ b/xcsv.cc
@@ -1894,7 +1894,9 @@ XcsvFormat::rd_init(const QString& fname)
     datum_name = "WGS 84";
   }
   xcsv_file->gps_datum_idx = GPS_Lookup_Datum_Index(datum_name);
-  is_fatal(xcsv_file->gps_datum_idx < 0, MYNAME ": datum \"%s\" is not supported.", qPrintable(datum_name));
+  if (xcsv_file->gps_datum_idx < 0) {
+    fatal(MYNAME ": datum \"%s\" is not supported.", qPrintable(datum_name));
+  }
   assert(gps_datum_wgs84 == GPS_Lookup_Datum_Index("WGS 84"));
 }
 
@@ -1973,7 +1975,9 @@ XcsvFormat::wr_init(const QString& fname)
     datum_name = "WGS 84";
   }
   xcsv_file->gps_datum_idx = GPS_Lookup_Datum_Index(datum_name);
-  is_fatal(xcsv_file->gps_datum_idx < 0, MYNAME ": datum \"%s\" is not supported.", qPrintable(datum_name));
+  if (xcsv_file->gps_datum_idx < 0) {
+    fatal(MYNAME ": datum \"%s\" is not supported.", qPrintable(datum_name));
+  }
   assert(gps_datum_wgs84 == GPS_Lookup_Datum_Index("WGS 84"));
 }